package com.study.mybatis.executor;

import com.study.mybatis.mapping.MappedStatement;
import com.study.mybatis.session.ResultHandler;

import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;

/**
 * @author yuantongqin
 * 2021/8/2
 **/
public abstract class BaseExecutor implements Executor{

    protected Executor wrapper;

    public BaseExecutor() {
        wrapper = this;
    }

    public abstract  <E> List<E> doQuery(MappedStatement ms, Object parameter, ResultHandler resultHandler) throws SQLException ;



    protected void closeStatement(Statement statement) {
        if (statement != null) {
            try {
                statement.close();
            } catch (SQLException e) {
                // ignore
            }
        }
    }

}
